﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace TGMTireBuilder {
    /// <summary>
    /// Interaction logic for PressureList.xaml
    /// </summary>
    public partial class VelocityList : UserControl {
        public VelocityList() {
            InitializeComponent();
        }

        private void AddBtn_Click( object sender, RoutedEventArgs e ) {
            List.Items.Add( new UnitControls.VelocityInput() );
        }

        private void RemBtn_Click( object sender, RoutedEventArgs e ) {
            if ( List.Items.Count > 0 )
                List.Items.Remove( List.Items[List.Items.Count - 1] );
        }

        public double GetValue( int index ) {
            if ( index < 0 || index >= List.Items.Count )
                return 0.0;

            UnitControls.VelocityInput a = (UnitControls.VelocityInput)List.Items.GetItemAt( index );
            return a.Value;
        }

        public int GetCount() {
            return List.Items.Count;
        }
    }
}
